package com.docker.fy.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.docker.common.annotation.Log;
import com.docker.common.core.controller.BaseController;
import com.docker.common.core.domain.AjaxResult;
import com.docker.common.enums.BusinessType;
import com.docker.fy.domain.fyNull;
import com.docker.fy.service.IfyNullService;
import com.docker.common.utils.poi.ExcelUtil;
import com.docker.common.core.page.TableDataInfo;

/**
 * 诊断Controller
 * 
 * @author fy
 * @date 2025-04-09
 */
@RestController
@RequestMapping("/diagnosis/diagnosis")
public class fyNullController extends BaseController
{
    @Autowired
    private IfyNullService fyNullService;



    /**
     * 查询诊断列表
     */
    @PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:list')")
    @GetMapping("/list")
    public TableDataInfo list(fyNull fyNull)
    {
        startPage();
        List<fyNull> list = fyNullService.selectfyNullList(fyNull);
        return getDataTable(list);
    }

    /**
     * 导出诊断列表
     */
    @PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:export')")
    @Log(title = "诊断", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, fyNull fyNull)
    {
        List<fyNull> list = fyNullService.selectfyNullList(fyNull);
        ExcelUtil<fyNull> util = new ExcelUtil<fyNull>(fyNull.class);
        util.exportExcel(response, list, "诊断数据");
    }

    /**
     * 获取诊断详细信息
     */
    @PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:query')")
    @GetMapping(value = "/{deptId}")
    public AjaxResult getInfo(@PathVariable("deptId") Long deptId)
    {
        return success(fyNullService.selectfyNullByDeptId(deptId));
    }

    /**
     * 新增诊断
     */
    @PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:add')")
    @Log(title = "诊断", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody fyNull fyNull)
    {
        return toAjax(fyNullService.insertfyNull(fyNull));
    }

    /**
     * 修改诊断
     */
    @PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:edit')")
    @Log(title = "诊断", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody fyNull fyNull)
    {
        return toAjax(fyNullService.updatefyNull(fyNull));
    }

    /**
     * 删除诊断
     */
    @PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:remove')")
    @Log(title = "诊断", businessType = BusinessType.DELETE)
	@DeleteMapping("/{deptIds}")
    public AjaxResult remove(@PathVariable Long[] deptIds)
    {
        return toAjax(fyNullService.deletefyNullByDeptIds(deptIds));
    }
}
